package org.mat.ipaas.ucenter.service.api.system;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.mat.framework.lang.dto.MatApiResponse;
import org.mat.ipaas.ucenter.service.dto.system.entity.SysPositionDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 职务表
 */
@Api(tags = "职务表")
@FeignClient(name = "mat-ipaas-ucenter-service", contextId = "sys-position-rest-api")
public interface SysPositionRestAPI {

    /**
     * 分页列表查询
     *
     * @param sysPositionDTO
     * @param pageNo
     * @param pageSize
     * @return
     */
    @ApiOperation(value = "职务表-分页列表查询", notes = "职务表-分页列表查询")
    @GetMapping(value = "/sys/position/list")
    MatApiResponse<Page<SysPositionDTO>> queryPageList(@SpringQueryMap SysPositionDTO sysPositionDTO,
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize);

    /**
     * 添加
     *
     * @param sysPositionDTO
     * @return
     */
    @ApiOperation(value = "职务表-添加", notes = "职务表-添加")
    @PostMapping(value = "/sys/position/add")
    MatApiResponse<SysPositionDTO> add(@RequestBody SysPositionDTO sysPositionDTO);

    /**
     * 编辑
     *
     * @param sysPositionDTO
     * @return
     */
    @ApiOperation(value = "职务表-编辑", notes = "职务表-编辑")
    @RequestMapping(value = "/sys/position/edit", method = {RequestMethod.POST})
    MatApiResponse<SysPositionDTO> edit(@RequestBody SysPositionDTO sysPositionDTO);

    /**
     * 通过id删除
     *
     * @param id
     * @return
     */
    @ApiOperation(value = "职务表-通过id删除", notes = "职务表-通过id删除")
    @DeleteMapping(value = "/sys/position/delete")
    MatApiResponse<?> delete(@RequestParam(name = "id", required = true) String id);

    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    @ApiOperation(value = "职务表-批量删除", notes = "职务表-批量删除")
    @DeleteMapping(value = "/sys/position/deleteBatch")
    MatApiResponse<SysPositionDTO> deleteBatch(@RequestParam(name = "ids", required = true) String ids);

    /**
     * 通过id查询
     *
     * @param id
     * @return
     */
    @ApiOperation(value = "职务表-通过id查询", notes = "职务表-通过id查询")
    @GetMapping(value = "/sys/position/queryById")
    MatApiResponse<SysPositionDTO> queryById(@RequestParam(name = "id", required = true) String id);

    /**
     * 导出excel
     */
    @RequestMapping(value = "/sys/position/exportXls")
    ModelAndView exportXls();

    /**
     * 通过excel导入数据
     *
     * @return
     */
    @RequestMapping(value = "/sys/position/importExcel", method = RequestMethod.POST)
    MatApiResponse<?> importExcel() throws IOException;

    /**
     * 通过code查询
     *
     * @param code
     * @return
     */
    @ApiOperation(value = "职务表-通过code查询", notes = "职务表-通过code查询")
    @GetMapping(value = "/sys/position/queryByCode")
    MatApiResponse<SysPositionDTO> queryByCode(@RequestParam(name = "code", required = true) String code);
}
